import React from 'react';
import { Snackbar, Alert } from '@mui/material';

interface MessageBoxProps {
  message: string;
  showMessage: boolean;
  onClose: () => void;
  severity: 'success' | 'error' | 'info' | 'warning';
}

export function MessageBox({ message, showMessage, onClose, severity }: MessageBoxProps) {
  return (
    <Snackbar
      open={showMessage}
      onClose={onClose}
      autoHideDuration={3000}
      anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
    >
      <Alert onClose={onClose} severity={severity}>
        {message}
      </Alert>
    </Snackbar>
  );
}
